/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cmvrc;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;


/**
 *
 * @author jarancibia
 */
public class CMVRC {
    
    
    public static Inicio init;
    public static SolicitudRTE solicitud;
    public static Acta acta;
    public static Identificacion log;
    public static SolicitudAnul anul;
    public static ListaSol listsol;
    public static ListaActa listact;
    public static String conectado;  
    
    
    public CMVRC(){ 
        
    }
    
    public static boolean isInternetReachable(){
        try {
        //make a URL to a known source
            URL url = new URL("http://www.google.com");

            //open a connection to that source
            HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection();

            //trying to retrieve data from the source. If there
            //is no connection, this line will fail
            Object objData = urlConnect.getContent();

        } catch (UnknownHostException e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            conectado="NO";
            return false;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            conectado="NO";
            return false;
        }
        conectado="SI";
        return true;
     }
    
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        
        final CMVRC cm=new CMVRC();
        cm.init = new Inicio();
        cm.solicitud = new SolicitudRTE();
        cm.acta = new Acta();
        cm.log = new Identificacion();
        cm.anul = new SolicitudAnul();
        cm.listsol = new ListaSol();
        cm.listact = new ListaActa();
        cm.conectado = "Conectado";
        
        cm.init.LoadCMVRC(cm);
        cm.solicitud.LoadCMVRC(cm);
        cm.acta.LoadCMVRC(cm);
        cm.log.LoadCMVRC(cm);
        cm.anul.LoadCMVRC(cm);
        cm.listsol.LoadCMVRC(cm);
        cm.listact.LoadCMVRC(cm);
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                cm.log.setVisible(true);
            }
        });
        
    }
}
